package lion.blog;

import lion.framework.core.db.DB;
import lion.mcenter.MFolderManager;
import lion.web.MenuManager;
import lion.web.module.IModule;
import lion.web.module.anno.Module;
import lion.web.platform.PlatformModule;

/**
 * @author lion
 * @email hl_0074@sina.com
 * @date 2015年8月25日
 */
@Module("blog")
public class BlogModule implements IModule {

	@Override
	public void init() {

		MenuManager.addMenu("", "#{admin}/blog", "BLOG", "", "博客系统");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/article", "ART", "page_white_h", "文章管理");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/article/edit", "EDIT", "page_edit", "写文章");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/comment", "CMT", "comments", "评论管理");
		// MenuManager.addMenu("BLOG", "/#{admin}/blog/catelog", "CAT",
		// "book_spelling", "分类管理");
		// MenuManager.addMenu("BLOG", "/#{admin}/blog/template", "TPL",
		// "notes_styles", "模板管理");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/setting", "SET", "page_white_gear", "博客设置");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/menu", "NAV", "category", "菜单设置");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/theme", "THM", "images", "主题管理");
		// MenuManager.addMenu("BLOG", "/#{admin}/blog/archive", "ARH",
		// "box_search", "归档管理");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/tags", "TAG", "three_tags", "Tag管理");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/source", "SRC", "macro_conditions", "来源管理");
		MenuManager.addMenu("BLOG", "/#{admin}/blog/frlinks", "FRL", "link", "友情链接");

		// 博客文档
		MFolderManager.registe("BLOG.Attach", "", "博客文件");
		// 加载博客站点信息
		initBlogContext();
	}

	public static void initBlogContext() {

		try (DB db = new DB()) {
			PlatformModule.eventManager.fire("blog.setting:change", db);
		} catch (Exception e) {
		}

	}

}
